# Contributor: Francesco Zanini <francesco@zanini.me>
# Contributor: Katie Holly <holly@fuslvz.ws>
# Contributor: Mike Crute <mike@crute.us>
# Maintainer: Mike Crute <mike@crute.us>
pkgname=bird
pkgver=2.14
pkgrel=0
pkgdesc="BIRD Internet Routing Daemon"
url="https://bird.network.cz/"
arch="all"
license="GPL-2.0-or-later"
makedepends="bison flex ncurses-dev readline-dev linux-headers libssh-dev"
install="$pkgname.pre-install $pkgname.pre-upgrade"
subpackages="$pkgname-dbg $pkgname-openrc"
source="
	$pkgname-$pkgver-2.tar.gz::https://bird.network.cz/download/bird-$pkgver.tar.gz
	bird.initd
	bird.confd
	"

# flawed test on big-endian
case "$CARCH" in
	s390x) options="!check";;
esac

build() {
	./configure --prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--runstatedir=/run \
		--enable-libssh
	make
}

check() {
	make test
}

package() {
	make DESTDIR="$pkgdir" install
	install -Dm755 "$srcdir"/bird.initd "$pkgdir"/etc/init.d/bird
	install -Dm644 "$srcdir"/bird.confd "$pkgdir"/etc/conf.d/bird
}

sha512sums="
f6b0672df048cfb78d289030675799e6d19db49d8cc458778d36a4e7c10a15be161dd101d7b03cf017f0fa948206d6504b59139515cbb80acc5bb1fdaa4358b9  bird-2.14-2.tar.gz
1e7cf8497469b26bbfe5a1f2b3ea2327362a90dfd2684ad150d2594f1c2e9d3ddf88b281087ff925a69e186d9d0f60aea98abc6408641b6bcea49ba5aa559842  bird.initd
0724e9414c276b4162e8d829f67500e41d0fd4732b9ac7f65f9d282214c8c110f22091be90d750990eafc03e2a5b66939537753d751502decc1d592602003116  bird.confd
"
